package edu.zzu.daoImpl;

import edu.zzu.Entity.Message;
import edu.zzu.dao.MessageDao;
import edu.zzu.mapper.MessageMapper;
import edu.zzu.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class MessageDaoImpl implements MessageDao {

    @Autowired
    private MessageMapper messageMapper;

    @Autowired
    private UserMapper userMapper;

    @Override
    public List<Message> getMessageByUserId(Long id) {
        return messageMapper.getMessageByUserId(id);
    }

    @Override
    public List<Message> getMessageByTel(String tel) {
        return messageMapper.getMessageByUserId(userMapper.getIdByTel(tel));
    }
}
